import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { SimpleNavLayoutComponent } from '../containers'

import { LoginComponent } from './login/login.component'
import { RegisterComponent } from './register/register.component'
import { P500Component } from './error/500.component'
import { AccessDenyComponent } from './access-deny/access-deny.component'
import { SettingsComponent } from './settings/settings.component'
import { PasswordComponent } from './password/password.component'
import { PasswordResetInitComponent } from './password-reset/init/password-reset-init.component'
import { PasswordResetFinishComponent } from './password-reset/finish/password-reset-finish.component'


export const commonState: Routes = [
  {
    path: 'login',
    data: {
      title: '登录'
    },
    component: LoginComponent
  },
  {
    path: 'register',
    data: {
      title: '注册'
    },
    component: RegisterComponent
  },
  {
    path: 'settings',
    component: SettingsComponent,
    data: {
      authorities: ['ROLE_USER'],
      title: '个人设置'
    },
  },
  {
    path: 'password',
    component: PasswordComponent,
    data: {
      authorities: ['ROLE_USER'],
      title: '修改密码'
    },
  },
  {
    path: '500',
    component: P500Component
  },
  {
    path: 'accessdeny',
    component: AccessDenyComponent
  },
  {
    path: 'reset',
    data: {
      authorities: ['ROLE_USER'],
      title: '重置密码'
    },
    children: [
      {
        path: 'init',
        component: PasswordResetInitComponent
      },
      {
        path: 'finish',
        component: PasswordResetFinishComponent
      }
    ]
  }
];
@NgModule({
  imports: [RouterModule.forChild(commonState)],
  exports: [RouterModule]
})
export class CommonRoutingModule {}
